import React, { useRef, useEffect, forwardRef } from 'react'
import { useGLTF, useAnimations } from '@react-three/drei'

const CoalChute = forwardRef((props, ref) => {
  const { nodes, materials, animations } = useGLTF('/models/fullyMechanizedExcavator.glb')
  const { actions } = useAnimations(animations, ref)
  useEffect(() => {
    for (const k in actions) {
      actions[k].play()
    }
  }, [actions]);
  return (
    <group visible={false} ref={ref} scale={0.001} dispose={null} >
      <group scale={0.3} position={[0, -1.4, -1.2]}>
        <mesh geometry={nodes.WHITE_PLASTIC.geometry} material={materials.PaletteMaterial002} position={[2.285412, 4.981432, -5.870017]} rotation={[-Math.PI / 2, 0, 0]} scale={0.075578} />
        <mesh geometry={nodes.SEAT.geometry} material={materials.SEAT} position={[2.276856, 4.981432, -5.870017]} rotation={[-Math.PI / 2, 0, 0]} scale={0.075578} />
        <mesh geometry={nodes.立方体008.geometry} material={materials.PaletteMaterial001} position={[1.738481, 7.534369, -1.910361]} />
        <mesh geometry={nodes.立方体030.geometry} material={materials.PaletteMaterial003} position={[3.841028, 4.773065, 2.140086]} scale={[-0.103128, 0.697869, 0.156041]} />
        <instancedMesh args={[nodes.立方体007.geometry, materials.PaletteMaterial001, 9]} instanceMatrix={nodes.立方体007.instanceMatrix} />
      </group>
    </group>
  )
})

useGLTF.preload('/models/fullyMechanizedExcavator.glb')

export default CoalChute;
